From: Colin Walters Date: Tue, 29 Apr 2025 22:16:31 +0000 (-0400) Subject: tests: Drop use of host_refspec X-Git-Tag: archive/raspbian/2025.7-2+rpi1^2^2~6^2~4^2~36^2~3 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=5d8b0a59d8dbc19e061f590aeb3176e91c9e3d30;p=ostree.git tests: Drop use of host_refspec There's no refspec on FCOS now using containers. We never needed a refspec for any of these, just the commit. --- diff --git a/tests/kolainst/data-shared/libinsttest.sh b/tests/kolainst/data-shared/libinsttest.sh index 927dc5e1..abfcdb8e 100644 --- a/tests/kolainst/data-shared/libinsttest.sh +++ b/tests/kolainst/data-shared/libinsttest.sh @@ -77,6 +77,5 @@ rpmostree_query_json() { query=$1 rpm-ostree status --json | jq -r "${query}" } -host_refspec=$(rpmostree_query_json '.deployments[0].origin') host_commit=$(rpmostree_query_json '.deployments[0].checksum') host_osname=$(rpmostree_query_json '.deployments[0].osname') diff --git a/tests/kolainst/destructive/auto-prune.sh b/tests/kolainst/destructive/auto-prune.sh index 38e88af0..9d974590 100755 --- a/tests/kolainst/destructive/auto-prune.sh +++ b/tests/kolainst/destructive/auto-prune.sh @@ -40,9 +40,9 @@ cd /root mkdir -p rootfs/usr/lib/modules/`uname -r` cp /usr/lib/modules/`uname -r`/vmlinuz rootfs/usr/lib/modules/`uname -r` dd if=/dev/urandom of=rootfs/usr/lib/modules/`uname -r`/vmlinuz count=1 conv=notrunc status=none -ostree commit --base "${host_refspec}" -P --tree=dir=rootfs -b modkernel1 +ostree commit --base "${host_commit}" -P --tree=dir=rootfs -b modkernel1 dd if=/dev/urandom of=rootfs/usr/lib/modules/`uname -r`/vmlinuz count=1 conv=notrunc status=none -ostree commit --base "${host_refspec}" -P --tree=dir=rootfs -b modkernel2 +ostree commit --base "${host_commit}" -P --tree=dir=rootfs -b modkernel2 assert_bootfs_has_n_bootcsum_dirs() { local expected=$1; shift diff --git a/tests/kolainst/destructive/deployment-lint b/tests/kolainst/destructive/deployment-lint index 7ef403d0..3aeefffe 100755 --- a/tests/kolainst/destructive/deployment-lint +++ b/tests/kolainst/destructive/deployment-lint @@ -7,7 +7,7 @@ require_writable_sysroot prepare_tmpdir mkdir -p rootfs/var/testcontent -ostree commit -b testlint --no-bindings --selinux-policy-from-base --tree=ref="${host_refspec}" --consume --tree=dir=rootfs +ostree commit -b testlint --no-bindings --selinux-policy-from-base --tree=ref="${host_commit}" --consume --tree=dir=rootfs ostree admin deploy testlint 2>err.txt assert_not_file_has_content err.txt 'Deploying commit.*which contains content in /var/testcontent' test '!' -d /var/testcontent diff --git a/tests/kolainst/destructive/itest-bare-root.sh b/tests/kolainst/destructive/itest-bare-root.sh index 2834a829..71cd1b2b 100755 --- a/tests/kolainst/destructive/itest-bare-root.sh +++ b/tests/kolainst/destructive/itest-bare-root.sh @@ -15,7 +15,7 @@ cd /ostree/repo/tmp rm co -rf rm co-testref -rf ostree refs --delete testref -ostree checkout -H ${host_refspec} co +ostree checkout -H ${host_commit} co victim_symlink=/usr/bin/gtar # Seems likely to stick around # Copy the link to avoid corrupting it cp co/${victim_symlink}{,.tmp} @@ -27,7 +27,7 @@ csum=$(ostree commit -b testref --link-checkout-speedup --tree=dir=co) ostree fsck ostree ls -X testref ${victim_symlink} > ls.txt assert_file_has_content ls.txt 'security\.biometric' -ostree ls -X ${host_refspec} ${victim_symlink} > ls.txt +ostree ls -X ${host_commit} ${victim_symlink} > ls.txt assert_not_file_has_content ls.txt 'security\.biometric' ostree ls -X testref usr/bin > ls.txt assert_file_has_content ls.txt 'security\.crunchy' diff --git a/tests/kolainst/destructive/itest-deploy-selinux.sh b/tests/kolainst/destructive/itest-deploy-selinux.sh index 099b5c27..004aa9c9 100755 --- a/tests/kolainst/destructive/itest-deploy-selinux.sh +++ b/tests/kolainst/destructive/itest-deploy-selinux.sh @@ -10,7 +10,7 @@ require_writable_sysroot date # Create a new deployment -ostree admin deploy --karg-proc-cmdline ${host_refspec} +ostree admin deploy --karg-proc-cmdline ${host_commit} new_deployment_path=/ostree/deploy/${host_osname}/deploy/${host_commit}.1 # Test /etc directory mtime diff --git a/tests/kolainst/destructive/itest-label-selinux.sh b/tests/kolainst/destructive/itest-label-selinux.sh index f166b611..ec242517 100755 --- a/tests/kolainst/destructive/itest-label-selinux.sh +++ b/tests/kolainst/destructive/itest-label-selinux.sh @@ -11,7 +11,7 @@ prepare_tmpdir /var/tmp date cd /ostree/repo/tmp rm co -rf -ostree checkout -H ${host_refspec} co +ostree checkout -H ${host_commit} co testbin=co/usr/bin/foo-a-generic-binary assert_not_has_file "${testbin}" # Make a test binary that we label as shell_exec_t on disk, but should be @@ -45,9 +45,9 @@ ostree refs --delete testbranch rm co -rf echo "ok commit with sepolicy" -ostree ls -X ${host_refspec} /usr/etc/sysctl.conf > ls.txt +ostree ls -X ${host_commit} /usr/etc/sysctl.conf > ls.txt if grep -qF ':etc_t:' ls.txt; then - ostree checkout -H ${host_refspec} co + ostree checkout -H ${host_commit} co ostree commit -b testbranch --link-checkout-speedup \ --selinux-policy co --tree=dir=co --selinux-labeling-epoch=1 ostree ls -X testbranch /usr/etc/sysctl.conf > ls.txt @@ -64,7 +64,7 @@ echo "ok --selinux-labeling-epoch=1" rm rootfs -rf if ostree checkout -H \ - --selinux-policy / ${host_refspec} co; then + --selinux-policy / ${host_commit} co; then assert_not_reached "checked out with -H and --selinux-policy" fi # recommit just two binaries into a new branch with selinux labels stripped @@ -124,7 +124,7 @@ assert_not_file_has_content lsz.txt ':bin_t:' rm -f lsz.txt echo 'somelib' > usr/lib/somelib.so echo 'someconf' > usr/etc/some.conf -ostree commit -b newbase --selinux-policy-from-base --tree=ref=${host_refspec} --tree=dir=$(pwd) +ostree commit -b newbase --selinux-policy-from-base --tree=ref=${host_commit} --tree=dir=$(pwd) ostree ls -X newbase /usr/bin/somebinary > newls.txt assert_file_has_content newls.txt ':bin_t:' ostree ls -X newbase /usr/lib/somelib.so > newls.txt diff --git a/tests/kolainst/destructive/overlay-initrds.sh b/tests/kolainst/destructive/overlay-initrds.sh index b24d2d08..b2c0880f 100755 --- a/tests/kolainst/destructive/overlay-initrds.sh +++ b/tests/kolainst/destructive/overlay-initrds.sh @@ -31,7 +31,7 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in "") create_initrd_with_dracut_karg ostree.test1 # let's use the deploy API first - ostree admin deploy "${host_refspec}" \ + ostree admin deploy "${host_commit}" \ --overlay-initrd /var/tmp/ostree.test1.img /tmp/autopkgtest-reboot "2" ;; @@ -45,7 +45,7 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in create_initrd_with_dracut_karg ostree.test2 # let's use the staging API this time - ostree admin deploy "${host_refspec}" --stage \ + ostree admin deploy "${host_commit}" --stage \ --overlay-initrd /var/tmp/ostree.test2.img /tmp/autopkgtest-reboot "3" ;; @@ -64,7 +64,7 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in test -f "/boot/ostree/initramfs-overlays/${test2_sha}.img" # OK, now let's deploy an identical copy of this test - ostree admin deploy "${host_refspec}" \ + ostree admin deploy "${host_commit}" \ --overlay-initrd /var/tmp/ostree.test2.img # Now the deployment with ostree.test1 should've been GC'ed; check that its @@ -74,12 +74,12 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in # deploy again to check that no bootconfig swap was needed; this verifies # that deployment overlay initrds can be successfully compared - ostree admin deploy "${host_refspec}" \ + ostree admin deploy "${host_commit}" \ --overlay-initrd /var/tmp/ostree.test2.img |& tee /tmp/out.txt assert_file_has_content /tmp/out.txt 'bootconfig swap: no' # finally, let's check that we can overlay multiple initrds - ostree admin deploy "${host_refspec}" --stage \ + ostree admin deploy "${host_commit}" --stage \ --overlay-initrd /var/tmp/ostree.test1.img \ --overlay-initrd /var/tmp/ostree.test2.img /tmp/autopkgtest-reboot "4" diff --git a/tests/kolainst/nondestructive/itest-pull.sh b/tests/kolainst/nondestructive/itest-pull.sh index 5e8776aa..38c4d7c6 100755 --- a/tests/kolainst/nondestructive/itest-pull.sh +++ b/tests/kolainst/nondestructive/itest-pull.sh @@ -18,7 +18,7 @@ trap _tmpdir_cleanup EXIT mkdir repo ostree --repo=repo init --mode=archive echo -e '[archive]\nzlib-level=1\n' >> repo/config -host_nonremoteref=$(echo ${host_refspec} | sed 's,[^:]*:,,') +host_nonremoteref=testref log_timestamps() { date "$@"